﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Generator.GeneratedCodeMapping
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using Microsoft.Internal.Web.Utils;
using System.Globalization;

namespace System.Web.Razor.Generator
{
  /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents the generated code mapping objects.</summary>
  public struct GeneratedCodeMapping
  {
    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Generator.GeneratedCodeMapping" /> class.</summary>
    /// <param name="startLine">The starting line.</param>
    /// <param name="startColumn">The starting column.</param>
    /// <param name="startGeneratedColumn">The start generated column.</param>
    /// <param name="codeLength">The code length.</param>
    public GeneratedCodeMapping(
      int startLine,
      int startColumn,
      int startGeneratedColumn,
      int codeLength)
      : this(new int?(), startLine, startColumn, startGeneratedColumn, codeLength)
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Generator.GeneratedCodeMapping" /> class.</summary>
    /// <param name="startOffset">The start offset.</param>
    /// <param name="startLine">The starting line.</param>
    /// <param name="startColumn">The starting column.</param>
    /// <param name="startGeneratedColumn">The start generated column.</param>
    /// <param name="codeLength">The code length.</param>
    public GeneratedCodeMapping(
      int startOffset,
      int startLine,
      int startColumn,
      int startGeneratedColumn,
      int codeLength)
      : this(new int?(startOffset), startLine, startColumn, startGeneratedColumn, codeLength)
    {
    }

    private GeneratedCodeMapping(
      int? startOffset,
      int startLine,
      int startColumn,
      int startGeneratedColumn,
      int codeLength)
      : this()
    {
      if (startLine < 0)
        throw new ArgumentOutOfRangeException(nameof (startLine), string.Format((IFormatProvider) CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, (object) nameof (startLine), (object) "0"));
      if (startColumn < 0)
        throw new ArgumentOutOfRangeException(nameof (startColumn), string.Format((IFormatProvider) CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, (object) nameof (startColumn), (object) "0"));
      if (startGeneratedColumn < 0)
        throw new ArgumentOutOfRangeException(nameof (startGeneratedColumn), string.Format((IFormatProvider) CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, (object) nameof (startGeneratedColumn), (object) "0"));
      if (codeLength < 0)
        throw new ArgumentOutOfRangeException(nameof (codeLength), string.Format((IFormatProvider) CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, (object) nameof (codeLength), (object) "0"));
      this.StartOffset = startOffset;
      this.StartLine = startLine;
      this.StartColumn = startColumn;
      this.StartGeneratedColumn = startGeneratedColumn;
      this.CodeLength = codeLength;
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets or sets the starting offset of the generated code maps.</summary>
    /// <returns>The starting offset of the generated code maps.</returns>
    public int? StartOffset { get; set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets or sets the length of the generated map codes.</summary>
    /// <returns>The length of the generated map codes.</returns>
    public int CodeLength { get; set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets or sets the starting column of the generated code maps.</summary>
    /// <returns>The starting column of the generated code maps.</returns>
    public int StartColumn { get; set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets or sets the starting column of a generated code maps in the generated source file.</summary>
    /// <returns>The starting column of a generated code maps in the generated source file.</returns>
    public int StartGeneratedColumn { get; set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the starting line of the generated code maps.</summary>
    /// <returns>The starting line of the generated code maps.</returns>
    public int StartLine { get; set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Determines whether the specified object is equal to the current generated code mapping object.</summary>
    /// <returns>true if the specified object is equal to the current generated code mapping object; otherwise, false.</returns>
    /// <param name="obj">The object to compare with the current object.</param>
    public override bool Equals(object obj)
    {
      if (!(obj is GeneratedCodeMapping generatedCodeMapping) || this.CodeLength != generatedCodeMapping.CodeLength || (this.StartColumn != generatedCodeMapping.StartColumn || this.StartGeneratedColumn != generatedCodeMapping.StartGeneratedColumn) || this.StartLine != generatedCodeMapping.StartLine)
        return false;
      return !this.StartOffset.HasValue || !generatedCodeMapping.StartOffset.HasValue || this.StartOffset.Equals((object) generatedCodeMapping.StartOffset);
    }

    /// <summary>Returns a string that represents the current object.</summary>
    /// <returns>A string that represents the current object.</returns>
    public override string ToString() => string.Format((IFormatProvider) CultureInfo.CurrentCulture, "({0}, {1}, {2}) -> (?, {3}) [{4}]", !this.StartOffset.HasValue ? (object) "?" : (object) this.StartOffset.Value.ToString((IFormatProvider) CultureInfo.CurrentCulture), (object) this.StartLine, (object) this.StartColumn, (object) this.StartGeneratedColumn, (object) this.CodeLength);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Returns the hash code for the generated code mapping object.</summary>
    /// <returns>The hash code for the generated code mapping object.</returns>
    public override int GetHashCode() => HashCodeCombiner.Start().Add(this.CodeLength).Add(this.StartColumn).Add(this.StartGeneratedColumn).Add(this.StartLine).Add((object) this.StartOffset).CombinedHash;

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Determines whether the two specified generated code mapping objects have the same value.</summary>
    /// <returns>true if the two specified generated code mapping objects have the same value; otherwise, false.</returns>
    /// <param name="left">The left generated code mapping objects.</param>
    /// <param name="right">The right generated code mapping objects.</param>
    public static bool operator ==(GeneratedCodeMapping left, GeneratedCodeMapping right) => left.Equals((object) right);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Determines whether the two specified generated code mapping objects have different values.</summary>
    /// <returns>true the two specified generated code mapping objects have different values; otherwise, false.</returns>
    /// <param name="right">The right generated code mapping objects.</param>
    public static bool operator !=(GeneratedCodeMapping left, GeneratedCodeMapping right) => !left.Equals((object) right);
  }
}
